package com.itheima.demo01;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class CopyFile {
    public static void main(String[] args) throws IOException {
        //实现文件拷贝

        //创建读取文件对象
        FileInputStream fis = new FileInputStream("a.txt");

        //创建写入文件对象
        FileOutputStream fos = new FileOutputStream("copya.txt");

        int byte1;
        long start = System.currentTimeMillis();
        while ((byte1 = fis.read()) != -1) {
            fos.write(byte1);
        }
        long end = System.currentTimeMillis();

        long diff = end - start;

        System.out.println(diff);

        //释放资源
        fis.close();
        fos.close();


    }
}
